import winston, { createLogger, format, transports } from 'winston';
import { is } from '@electron-toolkit/utils';

export const logger = createLogger({
    transports: [
        new transports.File({
            filename: 'logs/server.log',
            format: format.combine(
                format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
                format.align(),
                format.printf(
                    (info) =>
                        `${info.level}: ${[info.timestamp]}: ${info.message}`
                )
            ),
        }),
    ],
});
if (is.dev) {
    logger.add(new winston.transports.Console({
        format: winston.format.simple(),
    }));
}

